In [28]:
library(ggplot2)
library(MASS)
library(reshape2)
library(corrplot)
library(plyr)
library(mgcv)
library(sm)
library(vars)
library(lattice)
library(R2HTML)
library(knitr)
library(IRkernel)
options(repr.plot.width = 7)
options(repr.plot.height = 5)
In [29]:
DataOutback <-read.csv("Outback.csv", header=TRUE, sep=",")
DataOutback
Out[29]:
In [30]:
summary(DataOutback)
Out[30]:
In [31]:
cor(DataOutback)
Out[31]:
In [32]:
# qplot(DataOutback,
# x = DataOutback$RRO,
# y = DataOutback$TampilanO,
# position = position_jitter(w = 0.1, h = 0.1),
# xlab = "Retention Rate Outback",
# ylab = "Tampilan Interior Outback",
# main = "Hubungan Tampilan Interior dengan Retention Rate")
In [33]:
# qplot(x = RRO,
# TampilanO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Tampilan Interior Outback",
# main = "Hubungan Tampilan Interior dengan Retention Rate",
# formula = y ~ x)
In [34]:
regression_RRO_TampilanO = lm(RRO ~ TampilanO, data = DataOutback)
summary(regression_RRO_TampilanO)
Out[34]:
In [35]:
# qplot(x = RRO,
# y = MenuO,
# data = DataOutback,
# geom = c("point"),
# position = position_jitter(w = 0.1, h = 0.1),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Menu Outback",
# main = "Hubungan Tampilan Menu dengan Retention Rate",
# formula = y ~ x)
In [36]:
# qplot(x = RRO,
# y = MenuO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Menu Outback",
# main = "Hubungan Tampilan Menu dengan Retention Rate",
# formula = y ~ x)
In [37]:
regression_RRO_MenuO = lm(RRO ~ MenuO, data = DataOutback)
summary(regression_RRO_MenuO)
Out[37]:
In [38]:
# qplot(x = RRO,
# y = PackagingO,
# data = DataOutback,
# geom = c("point"),
# position = position_jitter(w = 0.1, h = 0.1),
# xlab = "Retention Rate Outback",
# ylab = "Packaging Outback",
# main = "Hubungan Tampilan Packaging dengan Retention Rate",
# formula = y ~ x)
In [39]:
# qplot(x = RRO,
# y = PackagingO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Packaging Outback",
# main = "Hubungan Tampilan Packaging Makanan dengan Retention Rate",
# formula = y ~ x)
In [40]:
regression_RRO_MenuO = lm(RRO ~ PackagingO, data = DataOutback)
summary(regression_RRO_MenuO)
Out[40]:
In [41]:
# qplot(x = RRO,
# y = WifiO,
# data = DataOutback,
# geom = c("point"),
# position = position_jitter(w = 0.1, h = 0.1),
# xlab = "Retention Rate Outback",
# ylab = "Wifi Outback",
# main = "Hubungan Wifi dengan Retention Rate pada Outback",
# formula = y ~ x)
In [42]:
# qplot(x = RRO,
# y = WifiO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Wifi Outback",
# main = "Hubungan Wifi dengan Retention Rate",
# formula = y ~ x)
In [43]:
regression_RRO_wifiO = lm(RRO ~ WifiO, data = DataOutback)
summary(regression_RRO_wifiO)
Out[43]:
In [44]:
# qplot(x = RRO,
# y = PembayaranO,
# data = DataOutback,
# geom = c("point"),
# position = position_jitter(w = 0.1, h = 0.1),
# xlab = "Retention Rate Outback",
# ylab = "Pembayaran Outback",
# main = "Hubungan Servis Permbayaran dengan Retention Rate pada Outback",
# formula = y ~ x)
In [45]:
# qplot(x = RRO,
# y = PembayaranO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Service Pembayaran Outback",
# main = "Hubungan Tampilan Menu dengan Retention Rate",
# formula = y ~ x)
In [46]:
regression_RRO_PembayaranO = lm(RRO ~ PembayaranO, data = DataOutback)
summary(regression_RRO_PembayaranO)
Out[46]:
In [47]:
# qplot(x = RRO,
# y = PelayananO,
# data = DataOutback,
# geom = c("point"),
# position = position_jitter(w = 0.1, h = 0.1),
# xlab = "Retention Rate Outback",
# ylab = "Pelayanan Outback",
# main = "Hubungan Pelayanan dengan Retention Rate pada Outback",
# formula = y ~ x)
In [48]:
# qplot(x = RRO,
# y = PelayananO,
# data = DataOutback,
# geom = c("point", "smooth"),
# method = "lm",
# xlab = "Retention Rate Outback",
# ylab = "Pelayanan Outback",
# main = "Hubungan Pelayanan dengan Retention Rate",
# formula = y ~ x)
In [49]:
regression_RRO_PelayananO = lm(RRO ~ PelayananO, data = DataOutback)
summary(regression_RRO_PelayananO)
Out[49]:
In [50]:
reg_all <- lm(RRO ~ TampilanO + MenuO + PackagingO + WifiO + PembayaranO + PelayananO, data = DataOutback)
summary(reg_all)
Out[50]:
In [51]:
library(leaps)
regsubsets.out <-regsubsets(RRO ~ TampilanO + MenuO + PackagingO + WifiO + PembayaranO + PelayananO,
data = DataOutback,
nbest = 1, # 1 best model for each number of predictors
nvmax = NULL, # NULL for no limit on number of variables
force.in = NULL, force.out = NULL,
method = "exhaustive")
regsubsets.out
Out[51]:
In [52]:
summary.out <- summary(regsubsets.out)
as.data.frame(summary.out$outmat)
Out[52]:
In [53]:
# plot(regsubsets.out, scale = "adjr2", main = "Adjusted R^2")
In [54]:
reg_best <- lm(RRO ~ WifiO + PelayananO, data = DataOutback)
summary(reg_best)
Out[54]:
In [ ]:
In [ ]:
In [ ]: